package com.qsmx.store.app.main.mem.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.qsmx.store.app.R;
import com.qsmx.store.app.main.mem.holder.MemCardManagerImportantHolder;

import java.util.List;

public class MemCardManagerImportantAdapter extends RecyclerView.Adapter<MemCardManagerImportantHolder> {

    private Context mContext;

    private List<String> mChecksData;

    public MemCardManagerImportantAdapter(Context mContext) {
        this.mContext = mContext;
    }

    public void setData(List<String> mChecksData) {
        this.mChecksData = mChecksData;
    }

    @NonNull
    @Override
    public MemCardManagerImportantHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {

        return new MemCardManagerImportantHolder(LayoutInflater.from(mContext).inflate(R.layout.adapter_mem_card_manager_important, viewGroup, false));
    }

    @Override
    public void onBindViewHolder(@NonNull MemCardManagerImportantHolder memCardManagerImportantHolder, int i) {
        memCardManagerImportantHolder.tvMemSetCheck.setText(mChecksData.get(i));
    }

    @Override
    public int getItemCount() {
        if (mChecksData != null && mChecksData.size() > 0) {
            return mChecksData.size();
        } else {
            return 0;
        }
    }
}
